1. Field of the Invention
The present invention relates to an apparatus for analyzing a program and displaying the analyzed result and a method thereof. In particular, the present invention relates to an apparatus for analyzing a program, categorizing variables used in the program corresponding to a predetermined condition, and displaying the categorized variables and a method thereof.
2. Description of the Related Art
To allow the user to understand the process of a program, it is important to analyze variables used therein. In particular, it is important to analyze information of declared variables and the values of the variables.
Conventionally, only static information such as the name, data type, and size of each declared variable is analyzed. Thus, in a large-scale program including many variables or in a system that operates in association with a plurality of programs, the analyzed result cannot be effectively used for maintaining and improving a program.
FIGS. 1A and 1B are schematic diagrams for explaining a related art reference. In the conventional program analysis, a data type and a data size are extracted from declaratives of data and the extracted data type and data size are analyzed. For example, information of data type and data size shown in FIG. 1B is obtained as the analyzed result of the data type from declaratives of each data field (variable) of a COBOL program shown in FIG. 1A.
With the analyzed result shown in FIG. 1B, it is clear that the data types and the data sizes (two digits) of "ORDERED MONTH", "ORDERED DATE", "DELIVERED MONTH", and "DELIVERED DATE" are the same. However, with the analyzed result, it is not possible to know the restricting condition (value range) of each data field.
For example, "ORDERED DAY" and "DELIVERED DAY" have a common restricting condition "1 or more or 31 or less" as a value range. In other words, these data fields belong to a domain "day: value range is 1 or more or 31 or less". Further, the data type and the data size of "ORDERED DAY" and "ORDERED MONTH" are the same. However, the restricting conditions of "ORDERED DAY" and "ORDERED MONTH" differ from each other. In other words, while the restricting condition of "ORDERED DAY" is "an integer of 1 or more or 31 or less", the restricting condition of "ORDERED MONTH" is "an integer of 1 or more or 12 or less". In other words, "ORDERED DAY" and "ORDERED MONTH" belong to different domains.
A domain means "a defined range" or "an area of certain knowledge or interest" in a broad sense or "an object characterized by a featured concept" in a narrower sense. For example, "ORDERED DATE" and "DELIVERED DATE" belong to the concept of "YEAR/MONTH/DAY". In this case, "YEAR/MONTH/DAY" becomes one domain. In addition, "YEAR/MONTH/DAY" can be divided into "YEAR", "MONTH", and "DAY". However, each of "YEAR", "MONTH", and "DAY" is also one domain.
A domain definition is how a domain is defined with a restricting condition (value range). For example, "DAY" is defined as "an integer of 1 or more or 31 or less". "MONTH" is defined as "an integer of 1 or more or 12 or less".
When such domain information (the restricting conditions of each variable) can be automatically extracted from a conventional program, it is considered that the program can be effectively understood, debugged, maintained, and modified. However, so far, variables have not been categorized from a view point of domains. In addition, restricting conditions for individual variables and restricting conditions featuring domains have not been extracted.